﻿using System.Text.RegularExpressions;

namespace FakeXiecheng.API.ResourceParameters
{
    public class TouristRouteParamaters
    {
        public string Keyword { get; set; }

        public string RatingOperator { get; set; }

        public int? RatingValue { get; set; }

        private string _rating { get; set; }

        public string Rating
        {
            get { return _rating; }
            set
            {

                if (!string.IsNullOrWhiteSpace(value))
                {
                    Regex regex = new Regex(@"([A-Za-z0-9\-]+)(\d+)");
                    Match match = regex.Match(value);
                    if (match.Success)
                    {
                        RatingOperator = match.Groups[1].Value;
                        RatingValue = Int32.Parse(match.Groups[2].Value);
                    }
                }
                //value是Rating接收到的外界的值
                _rating = value;

            }
        }



    }
}
